word2id ={}
id2word = []
with open('vocab.txt',encoding='utf-8') as f:
    for cur_id,word in enumerate(f):
        word = word.strip()
        word2id[word] = cur_id
        id2word.append(word)

print(word2id)